﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EIS_desktop
{
    public partial class ProjectInfo : Form
    {

        public ProjectInfo()
        {
            InitializeComponent();
        }

        // Name textbox validation//
        private void tname_Validating(object sender, CancelEventArgs e)
        {
            if (tname.Text == "")
            {
                errorProvider1.SetError(tname, " enter name field");
            }
            else
            {
                errorProvider1.SetError(tname, "");
            }

        }

        // Salary validation//
        private void tsalary_Validating(object sender, CancelEventArgs e)
        {
            try
            {
                int x = Int32.Parse(tsalary.Text);
                errorProvider1.SetError(tsalary, "");
            }
            catch (Exception)
            {
                errorProvider1.SetError(tsalary, " Enter Numeric value");
            }
        }


       


        private void tclientsuprvr_Validating(object sender, CancelEventArgs e)
        {
            if (tclientsuprvr.Text == "")
            {
                errorProvider1.SetError(tclientsuprvr, "Field to be entered");
            }
            else
            {
                errorProvider1.SetError(tclientsuprvr, "");
            }

        }

        private void cjobduties_Validating(object sender, CancelEventArgs e)
        {
            if (cjobduties.SelectedIndex == -1)
            {
                errorProvider1.SetError(cjobduties, "Choose atleast one option");
            }
            else
            {
                errorProvider1.SetError(cjobduties, "");
            }
        }


      

        private void tjobtitle_Validating(object sender, CancelEventArgs e)
        {
            if (tjobtitle.Text == "")
            {
                errorProvider1.SetError(tjobtitle, "please enter required field");
            }
            else
            {
                errorProvider1.SetError(tjobtitle, "");
            }

        }


        private void tworkaddr_Validating(object sender, CancelEventArgs e)
        {
            if (tworkaddr.Text == "")
            {
                errorProvider1.SetError(tworkaddr, "please enter complete address");
            }
            else
            {
                errorProvider1.SetError(tworkaddr, "");
            }
        }


        private void toffsitesuprvsr_Validating(object sender, CancelEventArgs e)
        {
            if (toffsitesuprvsr.Text == "")
            {
                errorProvider1.SetError(toffsitesuprvsr, "please enter required field");
            }
            else
            {
                errorProvider1.SetError(toffsitesuprvsr, "");
            }

        }

        private void dateTimePicker1_Validating(object sender, CancelEventArgs e)
        {
            if (dateTimePicker1.Value < DateTime.Today)
            {
                errorProvider1.SetError(dateTimePicker1, "Choose the Date Greater than or Equal to Current Date");
            }
            else
            {
                errorProvider1.SetError(dateTimePicker1,"");
            }

        }
    }
}

        










    
        
       


    


       

       
    
       
        
      
           

 

    

        

    
